﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Internet_Deliver_Therapy.Models;

namespace Internet_Deliver_Therapy.Views.Admin
{
    public partial class ConsentForm : System.Web.UI.Page
    {
        private Users user;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["User"] != null)
            {
                user = (Users)Session["User"];
            }
        }

        protected void Back_Click(object sender, EventArgs e)
        {
            
        }

        protected void Next_Click(object sender, EventArgs e)
        {
            bool checkedAll = false;
            int numberOfCheckedItems = 0;
            foreach(ListItem item in cbConsentForm.Items)
            {
                if (item.Selected)
                {
                    numberOfCheckedItems++;
                }
            }

            if (numberOfCheckedItems == 4)
            {
                checkedAll = true;
            }

            if(checkedAll)
            {
                Session["User"] = user;
                Response.Redirect("Confirmation.aspx");
            }
            else
            {
                ErrorMessage.Text = "We have notice that you did not check all the boxes.  Please contact your psychiatrist at 6555 8828  for further assistance.";
            }
        }
    }
}